package main

import "fmt"

var resume chan int

func main() {
	resume = Integers()
	for i := 0; i < 100; i++ {
		fmt.Println(genInteger())
	}
}

func genInteger() int {
	return <- resume
}

func Integers() chan int{
	yield := make(chan int)
	count := 0
	go func() {
		for true {
			yield <- count
			count++
		}
	}()
	return yield
}
